//package com.ycrlkj.android.modulespublic.common.net.converter;
//
//import com.google.gson.Gson;
//import com.google.gson.TypeAdapter;
//import com.google.gson.reflect.TypeToken;
//
//import java.io.File;
//import java.lang.annotation.Annotation;
//import java.lang.reflect.Type;
//
//import okhttp3.RequestBody;
//import okhttp3.ResponseBody;
//import retrofit2.Converter;
//import retrofit2.Retrofit;
//
///**
// * 创建时间：2018/4/3
// * 编写人： chengxin
// * 功能描述：json解析相关
// */
//public class GsonConverterFactory extends Converter.Factory {
//
//    public static GsonConverterFactory create() {
//        return create(new Gson());
//    }
//
//    @SuppressWarnings("ConstantConditions") // Guarding public API nullability.
//    public static GsonConverterFactory create(Gson gson) {
//        if (gson == null) throw new NullPointerException("gson == null");
//        return new GsonConverterFactory(gson);
//    }
//
//    private final Gson gson;
//
//    private GsonConverterFactory(Gson gson) {
//        this.gson = gson;
//    }
//
//    @Override
//    public Converter<ResponseBody, ?> responseBodyConverter(Type type, Annotation[] annotations, Retrofit retrofit) {
//        if (type != File.class) {
//            return new GsonResponseBodyConverter<>(gson, type);
//        }
//        return null;
//    }
//
//    @Override
//    public Converter<?, RequestBody> requestBodyConverter(Type type, Annotation[] parameterAnnotations, Annotation[] methodAnnotations, Retrofit retrofit) {
//        if (type != File.class) {
//            TypeAdapter<?> adapter = gson.getAdapter(TypeToken.get(type));
//            return new GsonRequestBodyConverter<>(gson, adapter);
//        }
//        return null;
//    }
//}
